﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using HandLab.Mvc3App.Aspx.Models.Entities;
using HandLab.Mvc3App.Aspx.Models.Interfaces;

namespace HandLab.Mvc3App.Aspx.Models.MockModels
{
    public class MockAnnounceService : IAnnounceService
    {
        public void Release(AnnounceInfo announce)
        {
            throw new Exception("发布公告失败了？原来？没原因！我是业务组件，我说失败就失败！");
        }

        public void Notify(AnnounceInfo announce)
        {
            return;
        }

        public void Remove(int id)
        {
            return;
        }

        public AnnounceInfo GetDetail(int id)
        {
            return new AnnounceInfo()
            {
                ID = id,
                Title = "第" + id + "则公告",
                Content = "全体员工每天晚上集体做俯卧撑！",
            };
        }

        public List<AnnounceInfo> GetByCategory(CategoryInfo category)
        {
            List<AnnounceInfo> announces = new List<AnnounceInfo>();
            for (int i = 1; i <= 10; i++)
            {
                AnnounceInfo announce = new AnnounceInfo
                {
                    ID = i,
                    Title = category.Name + "的第" + i + "则公告",
                    Content = "全体员工每天晚上集体做俯卧撑！",
                };

                announces.Add(announce);
            }

            return announces;
        }
    }
}